GtkCssProvider: Don't jump too eagerly to the next element when comparing selectors.
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 4 Aug 2010 09:43:18 +0000 (11:43 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:37:33 +0000 (15:37 +0100)
gtk/gtkcssprovider.c

index 692de7831a09b14975a51992a44289b9fcd444cf..7f83d1b304185383da24378a7a6b70cae2c8b2ad 100644 (file)
@@ -442,7 +442,20 @@ compare_selector (GtkWidgetPath *path,
       elem = elements->data;
 
       match = compare_selector_element (path, i, elem, &elem_score);
-      i++;
+
+      /* Only move on to the next index if there is no match
+       * with the current element (whether to continue or not
+       * handled right after in the combinator check), or a
+       * GType or glob has just been matched.
+       *
+       * Region and widget names do not trigger this because
+       * the next element in the selector path could also be
+       * related to the same index.
+       */
+      if (!match ||
+          (elem->elem_type == SELECTOR_GTYPE ||
+           elem->elem_type == SELECTOR_GLOB))
+        i++;
 
       if (!match &&
           elem->elem_type != SELECTOR_TYPE_NAME &&